package com.FashionShop.Controller;

import com.FashionShop.Dao.UserMapper;
import com.FashionShop.Domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class test {
    @Autowired
    UserMapper userMapper;
    @RequestMapping("test")
    @ResponseBody
    public String test(){
        return "test";
    }
    @RequestMapping("test2")
    @ResponseBody
    public String test2(User user){
        User user1 = new User();
        user1.setEmail("123456@qq.com");
        user1.setPassword("123");
        User login = userMapper.login(user1);
        return login.toString();
    }
    @RequestMapping("test3")
    @ResponseBody
    public User test3(User user){
        User user1 = new User();
        user1.setEmail("123456@qq.com");
        user1.setPassword("123");
        User login = userMapper.login(user1);
        ModelAndView mv = new ModelAndView();
        mv.addObject("user",login);
        login.setUserName("王者");
        return login;
    }
}
